package com.inossem.warehousestorage_inossem.request.inStorage;

import android.content.Context;

import com.google.gson.Gson;
import com.inossem.warehousestorage_inossem.bean.inStorage.InStorageReceiveConfirmRequestBean;
import com.inossem.warehousestorage_inossem.bean.receive.ConfirmBean;
import com.inossem.warehousestorage_inossem.constant.RequestConstant;
import com.inossem.warehousestorage_inossem.listener.GsonBeanListener;
import com.inossem.warehousestorage_inossem.listener.StringRequestListener;
import com.inossem.warehousestorage_inossem.manage.RequestManage;
import com.inossem.warehousestorage_inossem.model.StringResponse;
import com.inossem.warehousestorage_inossem.request.Request;

/**
 * Created by leij on 2017/6/13.
 */

public class InStorageReceiveConfirmRequest extends Request {
    public static String request(Context context, InStorageReceiveConfirmRequestBean paramsBean, GsonBeanListener gsonBeanListener) {
        String tag;
        String url = RequestManage.getUrl(context,RequestConstant.URL_IN_STORAGE_RECEIVE_CONFIRM);
        Gson gson = new Gson();
        String params = gson.toJson(paramsBean, paramsBean.getClass());
        tag = RequestManage.getHttpsPutWithLoading(context, url, params, new StringRequestListener() {
                @Override
                public void onSuccess(StringResponse stringRequestResponse) {
                    Gson gson = new Gson();
                    ConfirmBean bean = gson.fromJson(stringRequestResponse.getResponseInfo(), ConfirmBean.class);
                    excuteJsonBean(context, bean, bean.getCode(), bean.getMsg(), gsonBeanListener);
                }
            });
        return tag;
    }

}
